home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / HTABLE.XS_ / htable.xsl
Encoding:
Extensible Markup Language  |  2003-02-21  |  4.5 KB  |  106 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
  4.  
  5. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  6. <xsl:param name="sortby"/>
  7. <xsl:param name="title"/>
  8. <xsl:param name="datatype" select="'text'"/>
  9.  
  10. <xsl:template match="COMMAND">
  11. <table border="1">
  12.     <tr style="background-color:#a0a0ff;font:10pt Tahoma;font-weight:bold;" align="left">
  13.     <td>Node</td>
  14.     <xsl:for-each select="RESULTS[1]/CIM/INSTANCE[1]/PROPERTY|RESULTS[1]/CIM/INSTANCE[1]/PROPERTY.ARRAY|RESULTS[1]/CIM/INSTANCE[1]/PROPERTY.REFERENCE">
  15.         <td>
  16.         <xsl:value-of select="@NAME"/>
  17.         </td>
  18.     </xsl:for-each>
  19.     </tr>
  20.     <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  21.     <xsl:for-each select="RESULTS/CIM/INSTANCE">
  22.         <xsl:sort select="PROPERTY[@NAME=$sortby]|PROPERTY.ARRAY[@NAME=$sortby]|PROPERTY.REFERENCE[@NAME=$sortby]" data-type="{$datatype}"/>
  23.         <xsl:choose>
  24.         <xsl:when test="position() mod 2 < 1">
  25.             <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  26.             <td align="left"><xsl:value-of select="../../@NODE"/></td>
  27.             <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  28.                 <xsl:variable name="typevar" select="@TYPE"/>
  29.                 <td>
  30.                 <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  31.                     <xsl:apply-templates select=".">
  32.                         <xsl:with-param name="type">
  33.                             <xsl:value-of select="$typevar"/>
  34.                         </xsl:with-param>
  35.                     </xsl:apply-templates>
  36.                 </xsl:for-each>
  37.                 <span style="height:1px;overflow-y:hidden">.</span></td>
  38.             </xsl:for-each>
  39.             </tr>
  40.         </xsl:when>
  41.         <xsl:otherwise>
  42.             <tr style="background-color:#f0f0f0;font:10pt Tahoma;">
  43.             <td align="left"><xsl:value-of select="../../@NODE"/></td>
  44.             <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  45.                 <xsl:variable name="typevar" select="@TYPE"/>
  46.                 <td>
  47.                 <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  48.                     <xsl:apply-templates select=".">
  49.                         <xsl:with-param name="type">
  50.                             <xsl:value-of select="$typevar"/>
  51.                         </xsl:with-param>
  52.                     </xsl:apply-templates>
  53.                 </xsl:for-each>
  54.                 <span style="height:1px;overflow-y:hidden">.</span></td>
  55.             </xsl:for-each>
  56.             </tr>
  57.         </xsl:otherwise>
  58.         </xsl:choose>
  59.     </xsl:for-each>
  60.     </tr>
  61. </table>
  62. </xsl:template>
  63. <xsl:template match="VALUE.ARRAY">
  64.     <xsl:param name="type"/>
  65.     {<xsl:for-each select="VALUE">
  66.         <xsl:apply-templates select=".">
  67.             <xsl:with-param name="type">
  68.                 <xsl:value-of select="$type"/>
  69.             </xsl:with-param>
  70.             <xsl:with-param name="isarray">true</xsl:with-param>
  71.             <xsl:with-param name="includequotes">true</xsl:with-param>
  72.         </xsl:apply-templates>
  73.         <xsl:if test="position()!=last()">,</xsl:if>
  74.     </xsl:for-each>}
  75. </xsl:template>
  76. <xsl:template match="VALUE">
  77.     <xsl:param name="type"/>
  78.     <xsl:param name="includequotes"/>
  79.     <xsl:param name="isarray"/>
  80.     <xsl:choose>
  81.         <xsl:when test="$type='string'">
  82.             <xsl:if test="$includequotes='true'">"</xsl:if><xsl:value-of select="."/><xsl:if test="$includequotes='true'">"</xsl:if>
  83.         </xsl:when>
  84.         <xsl:when test="$type='char16'">
  85.             '<xsl:value-of select="."/>'
  86.         </xsl:when>
  87.         <xsl:when test="$type='uint16'or $type='uint32' or $type='uint64' or $type='uint8' or $type='real32'or $type='real64' or $type='sint16'or $type='sint32' or $type='sint64' or $type='sint8'">
  88.             <xsl:if test="$isarray='true'"><xsl:value-of select="."/></xsl:if>
  89.             <xsl:if test="not($isarray='true')"><div align="right"><xsl:value-of select="."/></div></xsl:if>
  90.         </xsl:when>
  91.         <xsl:otherwise>
  92.             <xsl:value-of select="."/>
  93.         </xsl:otherwise>
  94.     </xsl:choose>
  95. </xsl:template>
  96.  
  97. <xsl:template match="VALUE.REFERENCE"><xsl:apply-templates select="INSTANCEPATH/NAMESPACEPATH"/><xsl:apply-templates select="INSTANCEPATH/INSTANCENAME|INSTANCENAME"/></xsl:template>
  98. <xsl:template match="NAMESPACEPATH">\\<xsl:value-of select="HOST/text()"/><xsl:for-each select="LOCALNAMESPACEPATH/NAMESPACE">\<xsl:value-of select="@NAME"/></xsl:for-each>:</xsl:template>
  99. <xsl:template match="INSTANCENAME"><xsl:value-of select="@CLASSNAME"/><xsl:for-each select="KEYBINDING"><xsl:if test="position()=1">.</xsl:if><xsl:value-of select="@NAME"/>="<xsl:value-of select="KEYVALUE/text()"/>"<xsl:if test="position()!=last()">,</xsl:if></xsl:for-each></xsl:template>
  100. <xsl:template match="/" >
  101. <html>
  102. <H3><xsl:value-of select="$title" />  <xsl:value-of select="count(COMMAND/RESULTS/CIM/INSTANCE)"/> Instances of <xsl:value-of select="COMMAND/RESULTS/CIM/INSTANCE[1]/@CLASSNAME"/></H3>
  103. <xsl:apply-templates select="COMMAND"/>
  104. </html>
  105. </xsl:template>
  106. </xsl:stylesheet>